package com.lhl.jwt.security.service;

import io.swagger.annotations.Api;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;

/**
 * @className: com.lhl.jwt.security.service.JwtUserDetailsService
 * @description: 实现 loadUserByUsername 方法
 *根据项目需求是否需要产生随机salt 保存至数据库或缓存中
 * @author: king
 * @date: 2020-12-21 18:26
 **/
@Api(tags = "JwtUserDetailsService", produces = "JwtUserDetailsService")
public abstract class JwtUserDetailsService implements UserDetailsService {
    public void insertSalt(String salt, UserDetails user) {
        // null implements
    }

    public void removeSalt(String username) {
        // null implements
    }

    /**
     * BCrypt.gensalt()
     * 正式开放可使用该方法生成随机盐
     * @param username
     * @return
     */
    public String getSalt(String username) {
        // always return null
        return null;
    }

}
